<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
             label-width="68px">
    </el-form>

    <el-row :gutter="10" class="mb8">
    </el-row>

    <el-table border v-loading="loading" :data="dataList" @selection-change="handleSelectionChange">
      <el-table-column label="序号" align="center" type="index"/>
      <el-table-column label="回款金额" align="center" prop="pinMoney"/>
      <el-table-column label="回款日期" align="center" prop="pinDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.pinDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="备注信息" align="center" prop="remark"/>
    </el-table>

    <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum"
                :limit.sync="queryParams.pageSize" @pagination="getList"/>

    <projectFundBack-form ref="form" @ok="getList"></projectFundBack-form>
    <goodsInvoiceDetail ref="formHxDeatil"></goodsInvoiceDetail>
  </div>
</template>

<script>
import {deleteAction, getAction} from '@/api/manage'
import ProjectFundBackForm from '@/views/develop/projectFundBack/module/ProjectFundBackForm'
import GoodsInvoiceDetail from '@/views/develop/goodsInvoiceDetail/module/GoodsInvoiceDetail'

export default {
  name: "ProjectFundBackList",
  dicts: [],/*'prj_fund_back_type'*/
  components: {
    ProjectFundBackForm,
    GoodsInvoiceDetail,
  },
  props: {
    projectId: {
      type: [String, Number],
      required: true,
      default: ''
    },
    type: {
      type: String,
      required: true,
      default: ''
    }
  },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 项目回款信息管理表格数据
      dataList: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 20,
        backMoney: null,
        projectId: null,
        params:{
          fundCallback:"yhx",
        },
        projectName: null
      },
      url: {
        list: '/goodsInvoiceDetail/goodsInvoiceDetail/list',
      },
    };
  },
  watch: {
    'projectId': {
      handler(newVal, oldVal) {
        if (newVal) {
          this.queryParams.projectId = newVal;
          this.getList();
        }
      },
      deep: true,
      immediate: true
    },

  },
  created() {
    // this.queryParams.projectId = this.projectId;
    // this.getList();
  },
  methods: {
    /** 查询项目回款信息管理列表 */
    getList() {
      this.loading = true;
      this.queryParams.type = this.type;
      getAction(this.url.list, this.queryParams).then(response => {
        this.dataList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.$refs.form.handleUpdate(row);
    },

  }
};
</script>
